<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">{{title}}</div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>
      // app实例创建
      // new Vue
      function useTitle() {
        const state = Vue.reactive({
          title: "vue3,hello!",
        });
        setTimeout(() => {
          state.title = 'vue3'
        }, 1000);
        return state;
      }
      const app = Vue.createApp({
        data() {
          return {
            title: "hello,vue3",
          };
        },
        setup() {
          // 消灭this
          // 声明响应式数据
          // 复用性、可读性、可维护性
          // hook
          const state = useTitle();
          return {state}
        },
      });
      app.mount("#app");
    </script>
  </body>
</html>
